﻿using System.Diagnostics;

namespace BasicFramework.Helper
{
    public class TimerClock
    {

        #region Fields

        private bool isRunning;
        private long frequency;
        private long count;

        #endregion


        #region Properties

        #endregion


        #region Constructors

        #endregion


        #region Events

        #endregion


        #region Private methods

        #endregion


        #region Public methods

        public void Start()
        {
            count = Stopwatch.GetTimestamp();
            frequency = Stopwatch.Frequency;
            this.isRunning = true;
            this.isRunning = true;
        }

        public float Update()
        {
            float result = 0.0f;
            if (isRunning)
            {
                long last = count;
                count = Stopwatch.GetTimestamp();
                result = (float)(count - last) / frequency;
            }

            return result;
        }
        #endregion
    }
}
